﻿@using MyData.Dto
@model DepartDto
@{
    ViewBag.Title = "DepartView";
    Layout = "~/Views/Shared/_Index.cshtml";

}
<script src="~/Content/UI/js/select-ui.min.js"></script>
<form id="form1">
    <div class="tools">
        <ul class="toolbar">
            <li class="click" onclick="fnSave()"><span><img src="../Content/UI/images/t02.png" /></span>保存</li>
        </ul>
    </div>
    <div class="formbody">
        <ul class="forminfo">
            <li>
                <label>部门名称:</label><input value="@Model.Name" type="text" class="dfinput" id="Name" name="Name" required />

            </li>
            <li>
                <label>部门排序:</label><input value="@Model.OrderNum" type="number" class="dfinput" id="OrderNum" name="OrderNum" required />

            </li>
            <li>
                <label>部门显示:</label>   <cite style="height:32px"><input name="IsShow" style="height:32px" type="radio" value="1" checked="checked" />隐藏&nbsp;&nbsp;&nbsp;&nbsp;<input name="IsShow" style="height:32px" type="radio" value="0" />显示</cite>

            </li>
            <li>
                <label>部门备注:</label> <textarea cols="" rows="3" class="textinput" id="Remark">@Model.Remark</textarea>
            </li>
        </ul>
        <input type="hidden" id="Id" value="@Model.Id.ToString()" />
    </div>
</form>
<script type="text/javascript">
    $(function () {
        $("input[name='IsShow'][value=" + '@Model.IsShow' + "]").attr("checked", true);
        $(".select3").uedSelect({
            width: 300
        });
    })
    function fnSave() {
        if ($('#form1').valid()) {
            $.post('@Url.Action("SaveDepart", "Depart")', queryParams(), function (result) {
                if (result.state == 1) {
                    layer.msg('操作成功');
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index)
                    parent.$("#table").bootstrapTable('refresh');
                }
                else {
                    layer.msg(result.message);
                }
            })
        }
    }
    function queryParams() {
        return {
            Name: $("#Name").val(),
            Remark: $("#Remark").val(),
            OrderNum: $("#OrderNum").val(),
            IsShow: $("input[name='IsShow']:checked").val(),
            Id: $("#Id").val()
        };
    }
</script>
